/**
 * Created by 小虎Oni on 2016/10/10.
 */
var React = require('react');
var ReactDom = require('react-dom');
var AMUIReact  = require('amazeui-react');
var AMUITouch = require('amazeui-touch');
var ZBAcition = require('../custom/ZBActionCreators');
var jquery = require('jquery');
var LoginStore = require('../custom/store/LoginStore');
var View = AMUITouch.View;
var Container = AMUITouch.Container;
var Field = AMUITouch.Field;
var Icon = AMUITouch.Icon;
var List = AMUITouch.List;
var Button = AMUITouch.Button;
var NavBar = AMUITouch.NavBar;
var RouteInstance = require('react-router');
var Link = RouteInstance.Link;
var Login = React.createClass({
    Login:function(){
        var mobile = jquery('#loginPhone').val();
        var password = jquery('#loginPass').val();
        if(!mobile){
            alert('您还没有输入账号哦~');
            return false;
        }
        if(!password){
            alert('您还没有输入密码哦~');
            return false;
        }
        var data = {
            mobile:mobile,
            password:password
        };
        ZBAcition.loginAction(data);
    },
    render:function(){
        return (
            <View>
                <Container scrollable>
                    <div  className="login-box">
                        <NavBar title="登录" leftNav={[{href: '#/home',icon:'left-nav'}]}/>
                        <div className="login-input">
                            <List>
                                <List.Item  nested="input">
                                    <Field id="loginPhone" label={null}  placeholder={'请输入手机号码'} />
                                </List.Item>
                                <List.Item nested="input">
                                    <Field id="loginPass"  label={null}  placeholder={'请输入密码'} />
                                </List.Item>
                            </List>
                            <Button amStyle="alert" block={true} onClick={this.Login}>登录</Button>
                        </div>
                    </div>
                </Container>
            </View>
        )
    }
});

module.exports = Login;
